﻿using nanhua.BookStore.EntityFrameworkCore;
using nanhua.BookStore.Entitys.OrderAggregate;
using nanhua.BookStore.Entitys.ProductAggregate;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;

namespace nanhua.BookStore.Repositorys
{
    public class EfCoreProductRepository : EfCoreRepository<BookStoreDbContext, Product, Guid>, IProductRepository
    {
        public EfCoreProductRepository(
           IDbContextProvider<BookStoreDbContext> dbContextProvider)
           : base(dbContextProvider)
        {
        }
        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="productCode"></param>
        /// <returns></returns>
        public bool IsExistByProductCode(string productCode)
        {
            return this.Any(c => c.ProductCode == productCode);
        }
    }
}
